﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sylvain.Manager;

public partial class RecruitingServices : System.Web.UI.Page
{
    /// <summary>
    /// Display content of the Page.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Session[AppSession.SearchText.ToString()] = (this.Page.Master as SiteMaster).GetSearchText.Trim();
        }
        if (!IsPostBack || true)
        {
            ISylvainManager objManager = new SylvainManager();
            int pageId = objManager.GetPageId("recruiting_services");
            string pageContent = objManager.GetPageContent(pageId);
            if (pageContent.Length > 0)
            {
                mainDiv.InnerHtml = pageContent;
            }
            SelectedSearchText();
        }
    }

    private void SelectedSearchText()
    {
        if ((this.Page.Master as SiteMaster).GetSearchText.Trim() != "")
        {
            Session[AppSession.SearchText.ToString()] = (this.Page.Master as SiteMaster).GetSearchText.Trim();
        }
        else if (Session[AppSession.SearchText.ToString()] != null)
        {
            (this.Page.Master as SiteMaster).GetSearchText = Session[AppSession.SearchText.ToString()].ToString();
        }
        if ((this.Page.Master as SiteMaster).GetSearchText.Trim() != "")
        {
            mainDiv.InnerHtml = mainDiv.InnerHtml.Replace((this.Page.Master as SiteMaster).GetSearchText, "<span style='background-color:yellow;'>" + (this.Page.Master as SiteMaster).GetSearchText + "</span>");
        }
    }
}